<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>客户列表</title>

<link rel="stylesheet" href="/layui/css/layui.css">
<link rel="stylesheet" href="/hyqcss/public.css">
<script src="/cdn/echarts.min.js"></script>
<style type="text/css">
  body{
    background: #e9e9e9;
  }
  /*公共头部带搜索*/
  .public_container{
    margin: 20px;
    background: #fff;
  }
  .public_title_container{
    height: 54px;
    padding: 0 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    background: #f9f9f9;
    border-bottom: 1px solid #f0f0f0;
  }
  .public_title_container p{
    margin-right: 30px;
    height: 54px;
    line-height: 54px;
    cursor: pointer;
  }
  .public_title_container a{
    margin-right: 30px;
    height: 54px;
    line-height: 54px;
    cursor: pointer;
  }
  .public_title_active{
    color: #1E9FFF;
    border-bottom: 1px solid #1E9FFF;
  }
  .public_buttonSearch_container{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #fff;
  }
  .public_buttonSearch_container a{
    color: #fff;
    background-color: #1E9FFF;
    text-shadow: 0 -1px 0 rgba(0,0,0,.12);
    height: 24px;
    padding: 4px 15px;
    font-size: 14px;
    border-radius: 2px;
    display: flex;
    align-items: center;
  }
  .public_Search_container{
    position: relative;
  }
  .public_Search_container input{
    width: 240px;
    height: 32px;
    border: 1px solid #d9d9d9;
  }
  .public_Search_container i{
    position: absolute;
    bottom: 6px;
    right: 10px;
    cursor: pointer;
  }
  
  /*统计页面*/
  .public_statisticsHeader_content{
    padding: 20px 20px 0 20px;
  }
  .public_statisticsHeader_contaienr{
    /*margin-bottom: 20px;*/
    display: flex;
    justify-content: space-between;
    padding: 13px 20px;
    border: 1px solid #e0e0e0;
    background: #f9f9f9;
  }
  .qrcode_statistics_content{
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    margin: 0 20px;
  }
  .qrcode_statisticsEcharts_container{
    flex: 3;
    padding: 20px 0 10px 0;
    border-right: 1px solid #e0e0e0;
  }
  .qrcode_statisticsOther_container{
    flex: 1;
    padding: 20px 20px 10px 20px;
  }
  .qrcode_statisticsOther_container{

  }
  .qrcode_statisticsOther_container h3{
    color: #333;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 15px;
  }
  .qrcode_statisticsOther_container h5{
    color: #8c8c8c;
    font-size: 14px;
    text-align: center;
  }
  .qrcode_statisticsOther_List{

  }
  .qrcode_statisticsOther_List li{
    border-top: 1px dashed #e0e0e0;
    border-bottom: 1px dashed #e0e0e0;
    border-right: 1px dashed #e0e0e0;
    border-left: 2px solid #5b8ff9;
    height: 46px;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }
  .qrcode_statisticsOther_List li span{
    font-size: 14px;
    color: #595959;
  }
  .qrcode_statisticsOther_List li b{
    font-size: 14px;
    color: #f5222d;
  }
  .addChannels{
    border-left: 1px dashed #e0e0e0 !important;
    cursor: pointer;
    justify-content: center !important;
    color: #595959;
    font-size: 14px;
  }
</style>
<style type="text/css">
  .slide-btn{
    width:100px;
    display:inline-block;
    border:1px solid;
    border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
    border-radius:5px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
  }
  .slide-btn .inner-on,.slide-btn .inner-off{
    width:151px;
    box-sizing:border-box;
    display: inline-block;
    position: relative;
    left:0;
    cursor: pointer;
    transition:left 0.5s;
  }
  .inner-on .left,.inner-off .left{
    width: 50px;
    color: #fff;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
    background:#58b058;
    text-align:center;
    display: inline-block;
    padding: 4px 0;
  }
  .inner-on .space,.inner-off .space{
    width: 51px;
    display: inline-block;
    box-sizing:border-box;
    padding: 4px 0;
    color: #fff;
    background-color: #f5f5f5;
    border-left: 1px solid #cccccc;
    border-right: 1px solid #cccccc;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
    background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
    border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  }
  .inner-on .right,.inner-off .right{
    width: 50px;
    color: #fff;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
    background:#f9a123;
    text-align:center;
    display: inline-block;
    padding: 4px 0;
  }
  .customSwitch .layui-form-switch{
    margin-top: 0 !important;
  }
  .layui-table tr{
    height: 48px;
  }
</style>
</head>
<body>
<div class="public_container">
  <div class="qrcode_table_container" style="display: block;">
    <div class="public_buttonSearch_container">
      <a href="javascript:void(0);" onclick="tong()">同步客户</a>
      <form  method="get" action="" id="Form1">
      <div class="public_Search_container">
        <input type="text" id="index" value="{$nickname}" placeholder="请输入客服名称进行搜索" class="layui-input">
        <i class="layui-icon layui-icon-search" onclick="index()"></i>
      </div>
      </form>
    </div>
    <div class="public_table_container layui-form">
      <table class="layui-table" lay-skin="line"> 
          <thead>
            <tr>
              <th>客户头像</th>
              <th>客户昵称</th>
              <th>所属客服账号</th>
              <th>性别</th>
              <th>咨询时间</th>
              <th>最近对话时间</th>
              <th>剩余对话时间</th>
              <th>是否已加好友</th>
              <th>标签</th>
              <th>操作</th>
            </tr> 
          </thead>
          <tbody>
            {loop $external_list as $user}
               <tr>
               <td><img src="{$user->avatar}" width="30px"></td>
               <td>{$user->nickname}</td>
               <td>{$user->user['name']}</td>
               <td>{if $user->gender == 1}男{else}女{/if}</td>
               <td>{$user->mintime}</td>
               <td>{$user->maxtime}</td>
               <td>{$user->stime}</td>
               <td>{if $user->is_set}已为好友{else}未添加好友{/if}</td>
               <td>
                  {loop $user->tags as $tag}
                    {if $tagArr[$tag]}
                      <span class="layui-badge-rim lm-table-tag"> {$tagArr[$tag]}&nbsp;</span>
                    {/if}
                  {/loop}
                </td>
                <td>
            <a class="table-public-btn" onclick="external_user_tag({$user->id})">打标签</a></td>
             {/loop}
          </tbody>
      </table>
    </div> 
    <!-- 公共表格部分 end-->
    <div class="main-container-h pageing-container-h">
        <div class="pageing-content-h">
            <span>{$p->totalnum}条/{$p->totalpage}页</span>
        </div>
        <ul class="pageing-content-h">{P weidogsadmin}</ul>
      </div>
  </div>
  
</div>
<script src="/cdn/jquery.js"></script>
<script src="/layui/layui.js"></script>
<script src="/js/ajax.js"></script>
<script type="text/javascript">
     function tong(){
          myAjaxPost(false, true, 'create_external_list.html', function (resp) {
               if (resp.status == 'success') {
                    tusi(resp.msg);
                    setTimeout(function(){ 
                         location.reload(); 
                    },2000);
               }else{
                    tusi(resp.msg);
               }
          })
     }
     layui.use(['form'], function () {
          var layer = layui.layer;
     })

     function external_user_tag(id){
          layer.open({
               type: 2,
               title: '请选择使用人员',
               shadeClose: true,
               shade: 0.2,
               area: ['700px', '530px'],
               content: 'external_user_tag-'+id+'.html'
          }); 
     }

     function index(){
          var nickname = $("#index").val();
          window.location.href = window.location.pathname+"?nickname="+nickname;
     }

</script>
</body>
</html>